package com.example.dormitory_system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.dormitory_system.domain.dto.tsysuser.LateReturnAddDTO;
import com.example.dormitory_system.domain.enetiy.LateReturn;
import com.example.dormitory_system.domain.vo.tsysuser.LateReturnListVO;
import com.example.dormitory_system.service.LateReturnService;
import com.example.dormitory_system.mapper.LateReturnMapper;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author keenan
* @description 针对表【tb_late_return(晚归记录表)】的数据库操作Service实现
* @createDate 2025-03-26 15:30:23
*/
@Service
public class LateReturnServiceImpl extends ServiceImpl<LateReturnMapper, LateReturn>
    implements LateReturnService {
    @Autowired
    private LateReturnMapper lateReturnMapper;

    @Override
    public List<LateReturnListVO> sysListLateReturn(String name, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return lateReturnMapper.sysListLateReturn(name);
    }

    @Override
    public int addLateReturn(LateReturnAddDTO lateReturnAddDTO) {
        return lateReturnMapper.insert(BeanUtil.copyProperties(lateReturnAddDTO, LateReturn.class));
    }
}
